/**
 * QueryParamBean.java
 * Version 1.0.0
 * Created on 2018年8月25日
 *
 */
package com.yincheng.oes.business.base.question;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;

import com.yincheng.oes.business.util.Page;

/**
 * @author yangsy
 * @version 1.0.0
 * @since
 * 创建时间：2018年8月25日
 * <p>
 * 功能描述：问题列表查询参数实体
 * <p>
 * 邮箱地址：446948434@qq.com
 */
public class QueryParamBean {

    /**
     * 题目编号
     */
    private String quesCode;

    /**
     * 题目类型，1:A1型题，2:A2型题，3:B型题，4:X型题
     */
    private String quesType;

    /**
     * 题干
     */
    private String stem;

    /**
     * 题目
     */
    private String question;

    /**
     * 答案解析
     */
    private String analysis;

    /**
     * 创建时间起
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createStartTime;

    /**
     * 创建时间止
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date createEndTime;

    /**
     *
     */
    private String createTimeOrder;

    /**
     * 问题来源,1：书本、2：学生提问
     */
    private String quesSource;

    private Page page;

    /**
     * @return the quesCode
     */
    public String getQuesCode() {
        return quesCode;
    }

    /**
     * @param quesCode the quesCode to set
     */
    public void setQuesCode(String quesCode) {
        this.quesCode = quesCode;
    }

    /**
     * @return the quesType
     */
    public String getQuesType() {
        return quesType;
    }

    /**
     * @param quesType the quesType to set
     */
    public void setQuesType(String quesType) {
        this.quesType = quesType;
    }

    /**
     * @return the stem
     */
    public String getStem() {
        return stem;
    }

    /**
     * @param stem the stem to set
     */
    public void setStem(String stem) {
        this.stem = stem;
    }

    /**
     * @return the question
     */
    public String getQuestion() {
        return question;
    }

    /**
     * @param question the question to set
     */
    public void setQuestion(String question) {
        this.question = question;
    }

    /**
     * @return the analysis
     */
    public String getAnalysis() {
        return analysis;
    }

    /**
     * @param analysis the analysis to set
     */
    public void setAnalysis(String analysis) {
        this.analysis = analysis;
    }

    /**
     * @return the page
     */
    public Page getPage() {
        return page;
    }

    /**
     * @param page the page to set
     */
    public void setPage(Page page) {
        this.page = page;
    }

    /**
     * @return the createStartTime
     */
    public Date getCreateStartTime() {
        return createStartTime;
    }

    /**
     * @param createStartTime the createStartTime to set
     */
    public void setCreateStartTime(Date createStartTime) {
        this.createStartTime = createStartTime;
    }

    /**
     * @return the createEndTime
     */
    public Date getCreateEndTime() {
        return createEndTime;
    }

    /**
     * @param createEndTime the createEndTime to set
     */
    public void setCreateEndTime(Date createEndTime) {
        this.createEndTime = createEndTime;
    }

    /**
     * @return the createTimeOrder
     */
    public String getCreateTimeOrder() {
        return createTimeOrder;
    }

    /**
     * @param createTimeOrder the createTimeOrder to set
     */
    public void setCreateTimeOrder(String createTimeOrder) {
        this.createTimeOrder = createTimeOrder;
    }

    public String[] getStems() {
        String[] split = StringUtils.split(StringUtils.defaultIfBlank(stem, ""));
        List<String> newParams = new ArrayList<String>();
        for (String string : split) {
            string = "%" + string + "%";
            newParams.add(string);
        }
        return (String[]) newParams.toArray(new String[0]);
    }

    public String[] getQuestions() {
        String[] split = StringUtils.split(StringUtils.defaultIfBlank(question, ""));
        List<String> newParams = new ArrayList<String>();
        for (String string : split) {
            string = "%" + string + "%";
            newParams.add(string);
        }
        return (String[]) newParams.toArray(new String[0]);
    }

    /**
     * @return the quesSource
     */
    public String getQuesSource() {
        return quesSource;
    }

    /**
     * @param quesSource the quesSource to set
     */
    public void setQuesSource(String quesSource) {
        this.quesSource = quesSource;
    }
}
